package com.longsys.framework.server.mongo;

import com.longsys.eventsourcing.core.EventAggregate;
import lombok.Data;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;

import java.util.Map;

@Data
public class MongoAggregateEntity {

    @Id
    private ObjectId _id;

    private String system;

    private String aggregateName;

    private Map<String, Object> aggregateMap;

    public MongoAggregateEntity(EventAggregate eventAggregate) {
        this.system = eventAggregate.getSystem();
        this.aggregateName = eventAggregate.getAggregateType();
        this.aggregateMap = eventAggregate.getAggregateMap();
    }

}
